/**
 * Created by Administrator on 2019/10/6.
 */
var swiper = new Swiper('.swiper-container', {
    spaceBetween: 30,
    effect: 'fade',
    pagination: {
        el: '.swiper-pagination',
        clickable: true,
    },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
    autoplay:true,
    loop:true
});
var nav = document.querySelectorAll(".nav-bg > li");
var main = document.querySelectorAll(".xuan > div");

for(var i = 0; i<nav.length;i++){
    nav[i].index = i;
    nav[i].addEventListener('click',function () {
        for(var k = 0;k<nav.length;k++){
            nav[k].classList.remove('active');
            main[k].classList.remove('active');
        }
        this.classList.add('active');
        main[this.index].classList.add('active');
        

    })
}


var list1 = document.querySelector("#list1");
var list2 = document.querySelector("#list2");
var list3 = document.querySelector("#list3");
var side = document.querySelector("#side");
var ping = document.querySelector("#ping");
var geren_text = document.querySelector("#geren_text");

var touxiang = document.querySelector("#touxiang");
var xue_ceng = document.querySelector("#xue_ceng");
var xuan = document.querySelector("#xuan");

window.onscroll = function () {
    if ( document.body.scrollTop >= 300 || document.documentElement.scrollTop >= 300){
        side.style.display = 'block';
    }else {
        side.style.display = 'none';

    }

    list1.addEventListener('click',function(){
        window.scrollTo({
            top:835,
            behavior:'smooth'
        })
    })
    list2.addEventListener('click',function(){
        window.scrollTo({
            top:1645,
            behavior:'smooth'
        })
    })
    list3.addEventListener('click',function(){
        window.scrollTo({
            top:2468,
            behavior:'smooth'
        })
    })
    if ( document.body.scrollTop >= 300 || document.documentElement.scrollTop >= 300){
        touxiang.style.opacity = '1';
        touxiang.style.transform = "translateY(0px)";
    }
    if ( document.body.scrollTop >= 700 || document.documentElement.scrollTop >= 700){
        ping.style.opacity = '1';
        ping.style.transform = "translateY(0px)";
    }
    if ( document.body.scrollTop >= 600 || document.documentElement.scrollTop >= 600){
        geren_text.style.opacity = '1';
        geren_text.style.transform = "translateY(0px)";
    }
    if ( document.body.scrollTop >= 1200 || document.documentElement.scrollTop >= 1200){
        xue_ceng.style.opacity = '1';
        xue_ceng.style.transform = "translateY(0px)";
    }
    if ( document.body.scrollTop >= 1942 || document.documentElement.scrollTop >= 1942){
        xuan.style.opacity = '1';
        xuan.style.transform = "translateY(0px)";
    }

}
var li_dian = document.querySelector("#li_dian");
var xingcheng = document.querySelector("#xingcheng");
var guanbi = document.querySelector("#guanbi");
var xingcheng_p = document.querySelector("#xingcheng_p");
var guanbi_p = document.querySelector("#guanbi_p");
var li_dian2 = document.querySelector("#li_dian2")
li_dian.addEventListener( 'click', function() {
    xingcheng.style.display = "block";
    guanbi.style.display = "block";
})
guanbi.addEventListener('click',function () {
    xingcheng.style.display = "none";
    guanbi.style.display = "none";
})
li_dian2.addEventListener( 'click', function() {
    xingcheng_p.style.display = "block";
    guanbi_p.style.display = "block";
})
guanbi_p.addEventListener('click',function () {
    xingcheng_p.style.display = "none";
    guanbi_p.style.display = "none";
})